﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace mfe_proj
{
    public class WinUtility
    {
        public static void ChangeAllLabelsColor(System.Drawing.Color toColor, System.Windows.Forms.Control control)
        {
            foreach (System.Windows.Forms.Control ctrl in control.Controls)
            {
                if (ctrl is System.Windows.Forms.Label)
                if (ctrl.HasChildren)
                    ChangeAllLabelsColor(toColor, ctrl);
            }
        }


        public static Control GetFocused(Control.ControlCollection controls)
        {
            foreach (Control c in controls)
            {
                if (c.Focused)
                    return c;
                else if (c.ContainsFocus)
                    return GetFocused(c.Controls);
            }
            return null;
        }
    }
}
